﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IconYuan.Model.Entity.Markets
{
    /// <summary>
    /// 商品促销
    /// </summary>
    [SugarTable("t_promotion")]
    public class Promotion
    {
        /// <summary>
        /// 自增id
        /// </summary>
        [SugarColumn(IsPrimaryKey = true)]
        public int promotion_id { get; set; }
        /// <summary>
        /// 促销名称
        /// </summary>
        public string name { get; set; } = string.Empty;
        /// <summary>
        /// 活动开始时间
        /// </summary>
        public DateTime start_time { get; set; }
        /// <summary>
        /// 活动截止时间
        /// </summary>
        public DateTime end_time { get; set; }
        /// <summary>
        /// 促销类型: 1 单品促销, 2 满减促销, 3 限购促销
        /// </summary>
        public int type { get; set; }
        /// <summary>
        /// 促销扩展
        /// </summary>
        public string ext { get; set; }
        /// <summary>
        /// 权重(1-9999),数字越大权重越高,用户命中多个活动时只取一个活动,优先命中权限高的活动
        /// </summary>
        public int weight { get; set; } = 1;
        /// <summary>
        /// 状态：0 关闭, 1 显示
        /// </summary>
        public int status { get; set; } = 0;

        public int store_id { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime create_time { get; set; }
    }

    /// <summary>
    /// 单品促销扩展
    /// </summary>
    public class SinglePromotion
    {
        /// <summary>
        /// 最低购买数(达到此数量才享受优惠)
        /// </summary>
        public int min_count { get; set; } = 1;
        /// <summary>
        /// 最大购买数
        /// </summary>
        public int max_count { get; set; } = 20;

        /// <summary>
        /// 优惠类型: 1 单件商品一口价, 2 第二件以上每件单价减多少元, 3 单价打折
        /// </summary>
        public int type { get; set; } = 1;
        /// <summary>
        /// 按类型决定, type=1时表示一口价的价格, type=2 时表示第二件以上每件单价减多少元, type=3时表示按商品价打几折
        /// </summary>
        public decimal type_value { get; set; } = 0;
        /// <summary>
        /// 优惠的商品id
        /// </summary>
        public string goods_ids { get; set; } = string.Empty;
    }

    /// <summary>
    /// 满减促销扩展
    /// </summary>
    public class FullPromotion
    {
        /// <summary>
        /// 优惠类型: 1 总价满多少减多少, 2 买几件单价每件减多少元
        /// </summary>
        public int type { get; set; } = 1;

        /// <summary>
        /// 第一次满多少金额,例如满100元减10元
        /// </summary>
        public decimal first_limit { get; set; }
        /// <summary>
        /// 第一次减多少
        /// </summary>
        public decimal first_cut{ get; set; }
        /// <summary>
        /// 第二次满多少金额,例如满200减30元
        /// </summary>
        public decimal secend_limit { get; set; }
        /// <summary>
        /// 第二次减多少
        /// </summary>
        public decimal secend_cut{ get; set; }
        /// <summary>
        /// 最大购买数
        /// </summary>
        public int max_count { get; set; } = 20;

        /// <summary>
        /// 优惠的商品id
        /// </summary>
        public string goods_ids { get; set; } = string.Empty;

    }

    ///// <summary>
    ///// 限购促销
    ///// </summary>
    //public class LimitPromotion
    //{
    //    /// <summary>
    //    /// 优惠类型: 1 按购买数量限购, 100 订单进行中限购
    //    /// </summary>
    //    public int type { get; set; } = 1;
    //    /// <summary>
    //    /// 按类型决定, type=1按已付款的商品总数量限制, type=100 按正在进行的订单数量限制
    //    /// </summary>
    //    public decimal type_value { get; set; } = 0;
    //    /// <summary>
    //    /// 优惠的商品id
    //    /// </summary>
    //    public string goods_ids { get; set; } = string.Empty;
    //}
}
